package com.ms.task;

import com.ms.service.AttendanceRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 考勤定时任务：每天自动初始化未签到状态
 */
@Component
public class AttendanceScheduleTask {

    @Autowired
    private AttendanceRecordService attendanceRecordService;

    /**
     * 每天凌晨00:00:01执行，初始化当天考勤记录（未签到状态）
     * cron表达式：秒 分 时 日 月 周
     */
    @Scheduled(cron = "1 0 0 * * ?")
    public void initDailyAttendanceRecord() {
        attendanceRecordService.initDailyAttendance();
    }
}